home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1995 June / MacFormat 25.iso / Shareware City / Developers / OutOfPhase1.1 Source / OutOfPhase Folder / SampleWindow.h < prev    next >
Text File  |  1994-08-11  |  9KB  |  229 lines

  1. /* SampleWindow.h */
  2.  
  3. #ifndef Included_SampleWindow_h
  4. #define Included_SampleWindow_h
  5.  
  6. /* SampleWindow module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Screen */
  12. /* EventLoop */
  13. /* Menus */
  14. /* FixedPoint */
  15. /* Memory */
  16. /* MainWindowStuff */
  17. /* CodeCenter */
  18. /* SampleObject */
  19. /* SampleView */
  20. /* TextEdit */
  21. /* WindowDispatcher */
  22. /* Alert */
  23. /* GrowIcon */
  24. /* SampleTestPlay */
  25. /* DataMunging */
  26. /* Main */
  27. /* Numbers */
  28. /* PcodeSystem */
  29. /* PcodeStack */
  30. /* Scroll */
  31. /* SampleList */
  32. /* SampleConsts */
  33. /* EditImages */
  34. /* IconButton */
  35. /* SampleStorageActual */
  36. /* SampleStorageDisplay */
  37. /* FindDialog */
  38. /* GlobalWindowMenuList */
  39. /* CompilerRoot */
  40. /* FunctionCode */
  41. /* ExportWAVSample */
  42. /* ExportRAWSample */
  43. /* ExportAIFFSample */
  44.  
  45. #include "Screen.h"
  46. #include "EventLoop.h"
  47. #include "Menus.h"
  48. #include "FixedPoint.h"
  49. #include "SampleConsts.h"
  50.  
  51. struct SampleWindowRec;
  52. typedef struct SampleWindowRec SampleWindowRec;
  53.  
  54. /* forward declarations */
  55. struct MainWindowRec;
  56. struct SampleObjectRec;
  57. struct CodeCenterRec;
  58. struct SampleStorageActualRec;
  59. struct SampleListRec;
  60.  
  61. typedef enum {eSampleLoop1 EXECUTE(= - 732), eSampleLoop2, eSampleLoop3} SampleLoops;
  62.  
  63. /* create a new sample editing window.  the function gets ownership of SampleStorage */
  64. SampleWindowRec*        NewSampleWindow(struct MainWindowRec* MainWindow,
  65.                                             struct SampleObjectRec* SampleObject,
  66.                                             struct CodeCenterRec* CodeCenter,
  67.                                             struct SampleStorageActualRec* SampleStorage,
  68.                                             struct SampleListRec* SampleList,
  69.                                             OrdType WinX, OrdType WinY, OrdType WinWidth, OrdType WinHeight);
  70.  
  71. /* dispose of the window and write all modified data back */
  72. void                                DisposeSampleWindow(SampleWindowRec* Window);
  73.  
  74. /* returns True if any data has been changed since the last time the file was saved */
  75. MyBoolean                        HasSampleWindowBeenModified(SampleWindowRec* Window);
  76.  
  77. /* bring the window to the top and give it the focus */
  78. void                                SampleWindowBringToTop(SampleWindowRec* Window);
  79.  
  80. /* event handling routines */
  81. void                                SampleWindowDoIdle(SampleWindowRec* Window,
  82.                                             MyBoolean CheckCursorFlag, OrdType XLoc, OrdType YLoc,
  83.                                             ModifierFlags Modifiers);
  84. void                                SampleWindowBecomeActive(SampleWindowRec* Window);
  85. void                                SampleWindowBecomeInactive(SampleWindowRec* Window);
  86. void                                SampleWindowJustResized(SampleWindowRec* Window);
  87. void                                SampleWindowDoMouseDown(OrdType XLoc, OrdType YLoc,
  88.                                             ModifierFlags Modifiers, SampleWindowRec* Window);
  89. void                                SampleWindowDoKeyDown(unsigned char KeyCode,
  90.                                             ModifierFlags Modifiers, SampleWindowRec* Window);
  91. void                                SampleWindowClose(SampleWindowRec* Window);
  92. void                                SampleWindowUpdator(SampleWindowRec* Window);
  93. void                                SampleWindowMenuSetup(SampleWindowRec* Window);
  94. void                                SampleWindowDoMenuCommand(SampleWindowRec* Window,
  95.                                             MenuItemType* MenuItem);
  96.  
  97. /* copy data in the currently active text edit field to wherever it belongs */
  98. void                                SampleWindowFinalizeCurrentEdit(SampleWindowRec* Window);
  99.  
  100. /* get the editing version of the origin point */
  101. long                                SampleWindowGetOrigin(SampleWindowRec* Window);
  102.  
  103. /* get the current loop start point */
  104. long                                SampleWindowGetLoopStart(SampleWindowRec* Window);
  105.  
  106. /* get the current loop end point */
  107. long                                SampleWindowGetLoopEnd(SampleWindowRec* Window);
  108.  
  109. /* get the sampling rate */
  110. long                                SampleWindowGetSamplingRate(SampleWindowRec* Window);
  111.  
  112. /* get the natural recorded pitch */
  113. double                            SampleWindowGetNaturalFrequency(SampleWindowRec* Window);
  114.  
  115. /* copy the select start point from the sample view to the edit box */
  116. void                                SampleWindowPutSelectStart(SampleWindowRec* Window);
  117.  
  118. /* copy the select end point from the sample view to the edit box */
  119. void                                SampleWindowPutSelectEnd(SampleWindowRec* Window);
  120.  
  121. /* copy the scaling factor from the sample view to the edit box */
  122. void                                SampleWindowPutScalingFactor(SampleWindowRec* Window);
  123.  
  124. /* put a new origin point into the edit box */
  125. void                                SampleWindowPutOrigin(SampleWindowRec* Window, long NewOrigin);
  126.  
  127. /* put a new loop start into the current loop start edit box */
  128. void                                SampleWindowPutLoopStart(SampleWindowRec* Window, long NewLoopStart);
  129.  
  130. /* put a new loop end into the current loop end edit box */
  131. void                                SampleWindowPutLoopEnd(SampleWindowRec* Window, long NewLoopEnd);
  132.  
  133. /* put a new sampling rate into the sampling rate edit box */
  134. void                                SampleWindowPutSamplingRate(SampleWindowRec* Window,
  135.                                             long NewSamplingRate);
  136.  
  137. /* put a new natural recorded pitch into the natural frequency edit box */
  138. void                                SampleWindowPutNaturalFrequency(SampleWindowRec* Window,
  139.                                             double NewNaturalFrequency);
  140.  
  141. /* find the current mouse position and put it in the box */
  142. void                                SampleWindowPutMousePosition(SampleWindowRec* Window);
  143.  
  144. /* get the number of bits used to store the sample */
  145. NumBitsType                    SampleWindowGetNumBits(SampleWindowRec* Window);
  146.  
  147. /* get the number of channels the sample has */
  148. NumChannelsType            SampleWindowGetNumChannels(SampleWindowRec* Window);
  149.  
  150. /* get a copy of the name of the sample */
  151. char*                                SampleWindowGetNameCopy(SampleWindowRec* Window);
  152.  
  153. /* get the number of frames in the current sample */
  154. long                                SampleWindowGetNumFrames(SampleWindowRec* Window);
  155.  
  156. /* get a copy of the formula text */
  157. char*                                SampleWindowGetFormulaCopy(SampleWindowRec* Window);
  158.  
  159. /* get a copy of the left channel for a stereo sample. */
  160. largefixedsigned*        SampleWindowGetFixedArrayLeft(SampleWindowRec* Window);
  161.  
  162. /* get a copy of the right channel for a stereo sample. */
  163. largefixedsigned*        SampleWindowGetFixedArrayRight(SampleWindowRec* Window);
  164.  
  165. /* get a copy of a mono sample. */
  166. largefixedsigned*        SampleWindowGetFixedArrayMono(SampleWindowRec* Window);
  167.  
  168. /* put a new name in.  the caller is responsible for deleting NewName */
  169. void                                SampleWindowObjectNameChange(SampleWindowRec* Window, char* NewName);
  170.  
  171. /* evaluate the formula and modify the sample */
  172. void                                SampleWindowPerformCalculation(SampleWindowRec* Window);
  173.  
  174. /* redraw the origin and loop point bars */
  175. void                                SampleWindowRedrawThangs(SampleWindowRec* Window);
  176.  
  177. /* redraw the sample points that occur under the origin and loop point bars */
  178. void                                SampleWindowRedrawUnderThangs(SampleWindowRec* Window);
  179.  
  180. /* make sure the loop start and end are within the proper ranges */
  181. void                                AdjustSampleWindowThangs(SampleWindowRec* Window);
  182.  
  183. /* recalculate the scroll bar displacements and redraw it */
  184. void                                UpdateSampleWindowScrollbar(SampleWindowRec* Window);
  185.  
  186. /* handle a mouse down in the sample edit area. */
  187. void                                SampleWindowDoMouseDownInEdit(SampleWindowRec* Window, OrdType OrigX,
  188.                                             OrdType OrigY);
  189.  
  190. /* find out which loop the sample is editing */
  191. SampleLoops                    SampleWindowEditingWhichLoop(SampleWindowRec* Window);
  192.  
  193. /* force the sample data to be written back to the object.  this does not write */
  194. /* back any other data. */
  195. MyBoolean                        SampleWindowForceUpdateSampleObjectData(SampleWindowRec* Window);
  196.  
  197. /* get the raw data for the sample, in char or short form.  the caller must NOT */
  198. /* dispose of this data, and it will become invalid if any modifications are made */
  199. /* to the sample.  This is basically SampleObjectGetRawData() with a call to */
  200. /* SampleWindowForceUpdateSampleObjectData() to keep everything consistent. */
  201. char*                                SampleWindowGetRawData(SampleWindowRec* Window);
  202.  
  203. /* get the raw fixedpoint data for the sample. */
  204. largefixedsigned*        SampleWindowGetRawFixedPointData(SampleWindowRec* Window);
  205.  
  206. /* the document title has changed, so change the window title bar.  caller is */
  207. /* responsible for deleting the string, which should be non-null-terminated. */
  208. void                                SampleWindowGlobalNameChange(SampleWindowRec* Window,
  209.                                             char* NewFilename);
  210.  
  211. /* force the window title bar to be renamed even if the document hasn't been renamed */
  212. void                                SampleWindowResetTitlebar(SampleWindowRec* Window);
  213.  
  214. /* get an 'actual' sample object that contains the same data as the window.  the */
  215. /* caller must delete the object. */
  216. struct SampleStorageActualRec*    SampleWindowGetTheSampleActual(SampleWindowRec* Window);
  217.  
  218. /* force ALL modified data to be written back to the object.  this includes */
  219. /* calling SampleWindowForceUpdateSampleObjectData() */
  220. MyBoolean                        SampleWindowWritebackModifiedData(SampleWindowRec* Window);
  221.  
  222. /* this routine updates the loop points when some number of sample frames are */
  223. /* inserted or removed from the specified point.  (for removal, NumAddedFrames < 0) */
  224. /* it does NOT do any redrawing of the points. */
  225. void                                SampleWindowShiftPoints(SampleWindowRec* Window, long Position,
  226.                                             long NumAddedFrames);
  227.  
  228. #endif
  229.